#include <stdio.h>

int f(int a) {
    if ((a % 4 == 0 && a % 100 != 0) || (a % 400 == 0)) {
        return 1; 
    }
    return 0; 
}

int main() {
    int a;
    
    scanf("%d", &a);
    
    if (a < 2001 || a > 2100) {
        printf("Invalid year!\n");
        return 0;
    }
    
    int b = 0; 
    
    for (int i = 2004; i <= a; i += 4) { 
        if (f(i)) {
            printf("%d\n", i);
            b = 1; 
        }
    }
    if (!b) {
        printf("None\n");
    }

    return 0;
}
